//
//  LoginViewController.m
//  Lightthings
//
//  Created by Hero on 2024/11/15.
//

#import "LoginViewController.h"
#import "RegisterViewController.h"
#import "ForgetViewController.h"
@interface LoginViewController ()
@property (weak, nonatomic) IBOutlet UILabel *titleLab;
@property (weak, nonatomic) IBOutlet UILabel *subTitleLab;
@property (weak, nonatomic) IBOutlet UILabel *loginLab;
@property (weak, nonatomic) IBOutlet UITextField *phoneTF;
@property (weak, nonatomic) IBOutlet UITextField *passwordTF;
@property (weak, nonatomic) IBOutlet UIView *phoneView;
@property (weak, nonatomic) IBOutlet UIView *passwordView;
@property (weak, nonatomic) IBOutlet UIButton *loginBtn;
@property (weak, nonatomic) IBOutlet UIButton *registerBtn;
@property (weak, nonatomic) IBOutlet UIButton *forgetBtn;
@property (weak, nonatomic) IBOutlet UILabel *countryLab;

@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    NSMutableAttributedString * titlestr = [SWTool attS:SWString(@"欢迎使用Lighttings应用") f:U_sfont(24) c:JYColor_Main()];
    [titlestr addAttributes:@{NSFontAttributeName:U_font(24),} range:NSMakeRange(0, titlestr.length)];
    [titlestr addAttributes:@{NSFontAttributeName:U_sfont(24),} range:[SWString(@"欢迎使用Lighttings应用") rangeOfString:SWString(@"Lighttings")]];
    self.titleLab.attributedText = titlestr;
    self.subTitleLab.text = SWString(@"与您一起智能生活，健康运动");
    self.loginLab.text = SWString(@"登录");
    self.countryLab.text = SWString(@"国家/地区");
    
    self.countryLab.zh_action = kMsgForward(@"clickCountryLab", WKProxy(self));

    self.phoneView.layer.borderColor = KLColor(@"#cccccc").CGColor;
    self.passwordView.layer.borderColor = KLColor(@"#cccccc").CGColor;
    
    self.phoneTF.placeholder = SWString(@"请输入手机号/邮箱号");
    self.passwordTF.placeholder = SWString(@"请输入登录密码");
    self.phoneTF.clearButtonMode = UITextFieldViewModeWhileEditing;
    self.passwordTF.clearButtonMode = UITextFieldViewModeWhileEditing;
    
    [self.loginBtn setTitle:SWString(@"登录") forState:0];
    [self.registerBtn setTitle:SWString(@"注册账号") forState:0];
    [self.forgetBtn setTitle:SWString(@"忘记密码") forState:0];
    
    // Do any additional setup after loading the view from its nib.
}

- (IBAction)clickLoginEvent:(UIButton *)sender {
    [kAppDelegate enterTabbar];
}
- (IBAction)clickRegisterEvent:(UIButton *)sender {
    RegisterViewController * vc = [[RegisterViewController alloc] initWithNibName:@"RegisterViewController" bundle:nil];
    [self.navigationController pushViewController:vc animated:YES];
}
- (IBAction)clickForgetEvent:(UIButton *)sender {
    ForgetViewController * vc = [[ForgetViewController alloc] initWithNibName:@"ForgetViewController" bundle:nil];
    [self.navigationController pushViewController:vc animated:YES];
}
- (void)clickCountryLab {
    toast(@"忘记密码忘记密码忘记密码");
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
